﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OracleClient;
using System.Text;
using Meqs.Entity;

namespace Meqs.Logic.Implement.Oracle
{
    public class EvalSettingsLogic : AbEvalSettingsLogic
    {
        /// <summary>
        /// 查询评价分配明细
        /// </summary>
        /// <param name="causeID"></param>
        /// <param name="evalType"><see cref="EvalType"/></param>
        /// <param name="schoolMark"></param>
        /// <returns></returns>
        public override DataTable GetSettingsDetail(int causeID, EvalType evalType, string schoolMark)
        {
            OracleConnection conn = new OracleConnection(ConnectionString);
            try
            {
                conn.Open();
                OracleCommand cmd = conn.CreateCommand();
                cmd.CommandText = "GetSettingsDetailByResearch";
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new OracleParameter("p_researchid", causeID));
                cmd.Parameters.Add(new OracleParameter("p_schoolmark", schoolMark));

                OracleParameter returnValuePara = new OracleParameter("p_retcur", OracleType.Cursor);
                returnValuePara.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(returnValuePara);
                DataTable dt = new DataTable();
                OracleDataAdapter ad = new OracleDataAdapter(cmd);
                ad.Fill(dt);
                return dt;
            }
            catch (Exception)
            {
                return null;
            }
            finally
            {
                conn.Close();
            }
        }

        /// <summary>
        /// 查询评价分配明细
        /// </summary>
        /// <param name="gradeIndex"></param>
        /// <param name="schoolMark"></param>
        /// <returns></returns>
        public override DataTable GetSettingsDetailGrade(int gradeIndex, string schoolMark)
        {
            return null;
        }
    }
}
